using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;
namespace Extra.Data.Management
{
    [Serializable, XmlSchemaProvider("GetTypedDataSetSchema"), ToolboxItem(true), DesignerCategory("code"), GeneratedCode("System.Data.Design.TypedDataSetGenerator", "2.0.0.0"), HelpKeyword("vs.data.DataSet"), XmlRoot("dsData")]
    public class dsData : DataSet
    {
        private System.Data.SchemaSerializationMode _schemaSerializationMode;
        private DataDataTable tableData;

        [DebuggerNonUserCode]
        public dsData()
        {
            this._schemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
            base.BeginInit();
            this.InitClass();
            CollectionChangeEventHandler handler = new CollectionChangeEventHandler(this.SchemaChanged);
            base.Tables.CollectionChanged += handler;
            base.Relations.CollectionChanged += handler;
            base.EndInit();
        }

        [DebuggerNonUserCode]
        protected dsData(SerializationInfo info, StreamingContext context)
            : base(info, context, false)
        {
            this._schemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
            if (base.IsBinarySerialized(info, context))
            {
                this.InitVars(false);
                CollectionChangeEventHandler handler = new CollectionChangeEventHandler(this.SchemaChanged);
                this.Tables.CollectionChanged += handler;
                this.Relations.CollectionChanged += handler;
            }
            else
            {
                string s = (string)info.GetValue("XmlSchema", typeof(string));
                if (base.DetermineSchemaSerializationMode(info, context) == System.Data.SchemaSerializationMode.IncludeSchema)
                {
                    DataSet dataSet = new DataSet();
                    dataSet.ReadXmlSchema(new XmlTextReader(new StringReader(s)));
                    if (dataSet.Tables["Data"] != null)
                    {
                        base.Tables.Add(new DataDataTable(dataSet.Tables["Data"]));
                    }
                    base.DataSetName = dataSet.DataSetName;
                    base.Prefix = dataSet.Prefix;
                    base.Namespace = dataSet.Namespace;
                    base.Locale = dataSet.Locale;
                    base.CaseSensitive = dataSet.CaseSensitive;
                    base.EnforceConstraints = dataSet.EnforceConstraints;
                    base.Merge(dataSet, false, MissingSchemaAction.Add);
                    this.InitVars();
                }
                else
                {
                    base.ReadXmlSchema(new XmlTextReader(new StringReader(s)));
                }
                base.GetSerializationData(info, context);
                CollectionChangeEventHandler handler2 = new CollectionChangeEventHandler(this.SchemaChanged);
                base.Tables.CollectionChanged += handler2;
                this.Relations.CollectionChanged += handler2;
            }
        }

        [DebuggerNonUserCode]
        public override DataSet Clone()
        {
            dsData data = (dsData)base.Clone();
            data.InitVars();
            data.SchemaSerializationMode = this.SchemaSerializationMode;
            return data;
        }

        [DebuggerNonUserCode]
        protected override XmlSchema GetSchemaSerializable()
        {
            MemoryStream w = new MemoryStream();
            base.WriteXmlSchema(new XmlTextWriter(w, null));
            w.Position = 0L;
            return XmlSchema.Read(new XmlTextReader(w), null);
        }

        [DebuggerNonUserCode]
        public static XmlSchemaComplexType GetTypedDataSetSchema(XmlSchemaSet xs)
        {
            dsData data = new dsData();
            XmlSchemaComplexType type = new XmlSchemaComplexType();
            XmlSchemaSequence sequence = new XmlSchemaSequence();
            XmlSchemaAny item = new XmlSchemaAny
            {
                Namespace = data.Namespace
            };
            sequence.Items.Add(item);
            type.Particle = sequence;
            XmlSchema schemaSerializable = data.GetSchemaSerializable();
            if (xs.Contains(schemaSerializable.TargetNamespace))
            {
                MemoryStream stream = new MemoryStream();
                MemoryStream stream2 = new MemoryStream();
                try
                {
                    XmlSchema current = null;
                    schemaSerializable.Write(stream);
                    IEnumerator enumerator = xs.Schemas(schemaSerializable.TargetNamespace).GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        current = (XmlSchema)enumerator.Current;
                        stream2.SetLength(0L);
                        current.Write(stream2);
                        if (stream.Length == stream2.Length)
                        {
                            stream.Position = 0L;
                            stream2.Position = 0L;
                            while ((stream.Position != stream.Length) && (stream.ReadByte() == stream2.ReadByte()))
                            {
                            }
                            if (stream.Position == stream.Length)
                            {
                                return type;
                            }
                        }
                    }
                }
                finally
                {
                    if (stream != null)
                    {
                        stream.Close();
                    }
                    if (stream2 != null)
                    {
                        stream2.Close();
                    }
                }
            }
            xs.Add(schemaSerializable);
            return type;
        }

        [DebuggerNonUserCode]
        private void InitClass()
        {
            base.DataSetName = "dsData";
            base.Prefix = "";
            base.Namespace = "http://tempuri.org/dsData.xsd";
            base.EnforceConstraints = true;
            this.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
            this.tableData = new DataDataTable();
            base.Tables.Add(this.tableData);
        }

        [DebuggerNonUserCode]
        protected override void InitializeDerivedDataSet()
        {
            base.BeginInit();
            this.InitClass();
            base.EndInit();
        }

        [DebuggerNonUserCode]
        internal void InitVars()
        {
            this.InitVars(true);
        }

        [DebuggerNonUserCode]
        internal void InitVars(bool initTable)
        {
            this.tableData = (DataDataTable)base.Tables["Data"];
            if (initTable && (this.tableData != null))
            {
                this.tableData.InitVars();
            }
        }

        [DebuggerNonUserCode]
        protected override void ReadXmlSerializable(XmlReader reader)
        {
            if (base.DetermineSchemaSerializationMode(reader) == System.Data.SchemaSerializationMode.IncludeSchema)
            {
                this.Reset();
                DataSet dataSet = new DataSet();
                dataSet.ReadXml(reader);
                if (dataSet.Tables["Data"] != null)
                {
                    base.Tables.Add(new DataDataTable(dataSet.Tables["Data"]));
                }
                base.DataSetName = dataSet.DataSetName;
                base.Prefix = dataSet.Prefix;
                base.Namespace = dataSet.Namespace;
                base.Locale = dataSet.Locale;
                base.CaseSensitive = dataSet.CaseSensitive;
                base.EnforceConstraints = dataSet.EnforceConstraints;
                base.Merge(dataSet, false, MissingSchemaAction.Add);
                this.InitVars();
            }
            else
            {
                base.ReadXml(reader);
                this.InitVars();
            }
        }

        [DebuggerNonUserCode]
        private void SchemaChanged(object sender, CollectionChangeEventArgs e)
        {
            if (e.Action == CollectionChangeAction.Remove)
            {
                this.InitVars();
            }
        }

        [DebuggerNonUserCode]
        private bool ShouldSerializeData()
        {
            return false;
        }

        [DebuggerNonUserCode]
        protected override bool ShouldSerializeRelations()
        {
            return false;
        }

        [DebuggerNonUserCode]
        protected override bool ShouldSerializeTables()
        {
            return false;
        }

        [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Content), DebuggerNonUserCode]
        public DataDataTable Data
        {
            get
            {
                return this.tableData;
            }
        }

        [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), DebuggerNonUserCode]
        public DataRelationCollection Relations
        {
            get
            {
                return base.Relations;
            }
        }

        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible), DebuggerNonUserCode, Browsable(true)]
        public override System.Data.SchemaSerializationMode SchemaSerializationMode
        {
            get
            {
                return this._schemaSerializationMode;
            }
            set
            {
                this._schemaSerializationMode = value;
            }
        }

        [DebuggerNonUserCode, DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public DataTableCollection Tables
        {
            get
            {
                return base.Tables;
            }
        }

        [Serializable, GeneratedCode("System.Data.Design.TypedDataSetGenerator", "2.0.0.0"), XmlSchemaProvider("GetTypedTableSchema")]
        public class DataDataTable : DataTable, IEnumerable
        {
            private DataColumn columnCreated;
            private DataColumn columnDatabase;
            private DataColumn columnPath;
            private DataColumn columnSTT;
            private DataColumn columnVersion;

            public event dsData.DataRowChangeEventHandler DataRowChanged;

            public event dsData.DataRowChangeEventHandler DataRowChanging;

            public event dsData.DataRowChangeEventHandler DataRowDeleted;

            public event dsData.DataRowChangeEventHandler DataRowDeleting;

            [DebuggerNonUserCode]
            public DataDataTable()
            {
                base.TableName = "Data";
                this.BeginInit();
                this.InitClass();
                this.EndInit();
            }

            [DebuggerNonUserCode]
            internal DataDataTable(DataTable table)
            {
                base.TableName = table.TableName;
                if (table.CaseSensitive != table.DataSet.CaseSensitive)
                {
                    base.CaseSensitive = table.CaseSensitive;
                }
                if (table.Locale.ToString() != table.DataSet.Locale.ToString())
                {
                    base.Locale = table.Locale;
                }
                if (table.Namespace != table.DataSet.Namespace)
                {
                    base.Namespace = table.Namespace;
                }
                base.Prefix = table.Prefix;
                base.MinimumCapacity = table.MinimumCapacity;
            }

            [DebuggerNonUserCode]
            protected DataDataTable(SerializationInfo info, StreamingContext context)
                : base(info, context)
            {
                this.InitVars();
            }

            [DebuggerNonUserCode]
            public void AddDataRow(dsData.DataRow row)
            {
                base.Rows.Add(row);
            }

            [DebuggerNonUserCode]
            public dsData.DataRow AddDataRow(int STT, string Database, string Version, DateTime Created, string Path)
            {
                dsData.DataRow row = (dsData.DataRow)base.NewRow();
                row.ItemArray = new object[] { STT, Database, Version, Created, Path };
                base.Rows.Add(row);
                return row;
            }

            [DebuggerNonUserCode]
            public override DataTable Clone()
            {
                dsData.DataDataTable table = (dsData.DataDataTable)base.Clone();
                table.InitVars();
                return table;
            }

            [DebuggerNonUserCode]
            protected override DataTable CreateInstance()
            {
                return new dsData.DataDataTable();
            }

            [DebuggerNonUserCode]
            public virtual IEnumerator GetEnumerator()
            {
                return base.Rows.GetEnumerator();
            }

            [DebuggerNonUserCode]
            protected override Type GetRowType()
            {
                return typeof(dsData.DataRow);
            }

            [DebuggerNonUserCode]
            public static XmlSchemaComplexType GetTypedTableSchema(XmlSchemaSet xs)
            {
                XmlSchemaComplexType type = new XmlSchemaComplexType();
                XmlSchemaSequence sequence = new XmlSchemaSequence();
                dsData data = new dsData();
                XmlSchemaAny item = new XmlSchemaAny
                {
                    Namespace = "http://www.w3.org/2001/XMLSchema",
                    MinOccurs = 0M,
                    MaxOccurs = 79228162514264337593543950335M,
                    ProcessContents = XmlSchemaContentProcessing.Lax
                };
                sequence.Items.Add(item);
                XmlSchemaAny any2 = new XmlSchemaAny
                {
                    Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1",
                    MinOccurs = 1M,
                    ProcessContents = XmlSchemaContentProcessing.Lax
                };
                sequence.Items.Add(any2);
                XmlSchemaAttribute attribute = new XmlSchemaAttribute
                {
                    Name = "namespace",
                    FixedValue = data.Namespace
                };
                type.Attributes.Add(attribute);
                XmlSchemaAttribute attribute2 = new XmlSchemaAttribute
                {
                    Name = "tableTypeName",
                    FixedValue = "DataDataTable"
                };
                type.Attributes.Add(attribute2);
                type.Particle = sequence;
                XmlSchema schemaSerializable = data.GetSchemaSerializable();
                if (xs.Contains(schemaSerializable.TargetNamespace))
                {
                    MemoryStream stream = new MemoryStream();
                    MemoryStream stream2 = new MemoryStream();
                    try
                    {
                        XmlSchema current = null;
                        schemaSerializable.Write(stream);
                        IEnumerator enumerator = xs.Schemas(schemaSerializable.TargetNamespace).GetEnumerator();
                        while (enumerator.MoveNext())
                        {
                            current = (XmlSchema)enumerator.Current;
                            stream2.SetLength(0L);
                            current.Write(stream2);
                            if (stream.Length == stream2.Length)
                            {
                                stream.Position = 0L;
                                stream2.Position = 0L;
                                while ((stream.Position != stream.Length) && (stream.ReadByte() == stream2.ReadByte()))
                                {
                                }
                                if (stream.Position == stream.Length)
                                {
                                    return type;
                                }
                            }
                        }
                    }
                    finally
                    {
                        if (stream != null)
                        {
                            stream.Close();
                        }
                        if (stream2 != null)
                        {
                            stream2.Close();
                        }
                    }
                }
                xs.Add(schemaSerializable);
                return type;
            }

            [DebuggerNonUserCode]
            private void InitClass()
            {
                this.columnSTT = new DataColumn("STT", typeof(int), null, MappingType.Element);
                base.Columns.Add(this.columnSTT);
                this.columnDatabase = new DataColumn("Database", typeof(string), null, MappingType.Element);
                base.Columns.Add(this.columnDatabase);
                this.columnVersion = new DataColumn("Version", typeof(string), null, MappingType.Element);
                base.Columns.Add(this.columnVersion);
                this.columnCreated = new DataColumn("Created", typeof(DateTime), null, MappingType.Element);
                base.Columns.Add(this.columnCreated);
                this.columnPath = new DataColumn("Path", typeof(string), null, MappingType.Element);
                base.Columns.Add(this.columnPath);
            }

            [DebuggerNonUserCode]
            internal void InitVars()
            {
                this.columnSTT = base.Columns["STT"];
                this.columnDatabase = base.Columns["Database"];
                this.columnVersion = base.Columns["Version"];
                this.columnCreated = base.Columns["Created"];
                this.columnPath = base.Columns["Path"];
            }

            [DebuggerNonUserCode]
            public dsData.DataRow NewDataRow()
            {
                return (dsData.DataRow)base.NewRow();
            }

            [DebuggerNonUserCode]
            protected override System.Data.DataRow NewRowFromBuilder(DataRowBuilder builder)
            {
                return new dsData.DataRow(builder);
            }

            [DebuggerNonUserCode]
            protected override void OnRowChanged(DataRowChangeEventArgs e)
            {
                base.OnRowChanged(e);
                if (this.DataRowChanged != null)
                {
                    this.DataRowChanged(this, new dsData.DataRowChangeEvent((dsData.DataRow)e.Row, e.Action));
                }
            }

            [DebuggerNonUserCode]
            protected override void OnRowChanging(DataRowChangeEventArgs e)
            {
                base.OnRowChanging(e);
                if (this.DataRowChanging != null)
                {
                    this.DataRowChanging(this, new dsData.DataRowChangeEvent((dsData.DataRow)e.Row, e.Action));
                }
            }

            [DebuggerNonUserCode]
            protected override void OnRowDeleted(DataRowChangeEventArgs e)
            {
                base.OnRowDeleted(e);
                if (this.DataRowDeleted != null)
                {
                    this.DataRowDeleted(this, new dsData.DataRowChangeEvent((dsData.DataRow)e.Row, e.Action));
                }
            }

            [DebuggerNonUserCode]
            protected override void OnRowDeleting(DataRowChangeEventArgs e)
            {
                base.OnRowDeleting(e);
                if (this.DataRowDeleting != null)
                {
                    this.DataRowDeleting(this, new dsData.DataRowChangeEvent((dsData.DataRow)e.Row, e.Action));
                }
            }

            [DebuggerNonUserCode]
            public void RemoveDataRow(dsData.DataRow row)
            {
                base.Rows.Remove(row);
            }

            [Browsable(false), DebuggerNonUserCode]
            public int Count
            {
                get
                {
                    return base.Rows.Count;
                }
            }

            [DebuggerNonUserCode]
            public DataColumn CreatedColumn
            {
                get
                {
                    return this.columnCreated;
                }
            }

            [DebuggerNonUserCode]
            public DataColumn DatabaseColumn
            {
                get
                {
                    return this.columnDatabase;
                }
            }

            [DebuggerNonUserCode]
            public dsData.DataRow this[int index]
            {
                get
                {
                    return (dsData.DataRow)base.Rows[index];
                }
            }

            [DebuggerNonUserCode]
            public DataColumn PathColumn
            {
                get
                {
                    return this.columnPath;
                }
            }

            [DebuggerNonUserCode]
            public DataColumn STTColumn
            {
                get
                {
                    return this.columnSTT;
                }
            }

            [DebuggerNonUserCode]
            public DataColumn VersionColumn
            {
                get
                {
                    return this.columnVersion;
                }
            }
        }

        [GeneratedCode("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")]
        public class DataRow : System.Data.DataRow
        {
            private dsData.DataDataTable tableData;

            [DebuggerNonUserCode]
            internal DataRow(DataRowBuilder rb)
                : base(rb)
            {
                this.tableData = (dsData.DataDataTable)base.Table;
            }

            [DebuggerNonUserCode]
            public bool IsCreatedNull()
            {
                return base.IsNull(this.tableData.CreatedColumn);
            }

            [DebuggerNonUserCode]
            public bool IsDatabaseNull()
            {
                return base.IsNull(this.tableData.DatabaseColumn);
            }

            [DebuggerNonUserCode]
            public bool IsPathNull()
            {
                return base.IsNull(this.tableData.PathColumn);
            }

            [DebuggerNonUserCode]
            public bool IsSTTNull()
            {
                return base.IsNull(this.tableData.STTColumn);
            }

            [DebuggerNonUserCode]
            public bool IsVersionNull()
            {
                return base.IsNull(this.tableData.VersionColumn);
            }

            [DebuggerNonUserCode]
            public void SetCreatedNull()
            {
                base[this.tableData.CreatedColumn] = Convert.DBNull;
            }

            [DebuggerNonUserCode]
            public void SetDatabaseNull()
            {
                base[this.tableData.DatabaseColumn] = Convert.DBNull;
            }

            [DebuggerNonUserCode]
            public void SetPathNull()
            {
                base[this.tableData.PathColumn] = Convert.DBNull;
            }

            [DebuggerNonUserCode]
            public void SetSTTNull()
            {
                base[this.tableData.STTColumn] = Convert.DBNull;
            }

            [DebuggerNonUserCode]
            public void SetVersionNull()
            {
                base[this.tableData.VersionColumn] = Convert.DBNull;
            }

            [DebuggerNonUserCode]
            public DateTime Created
            {
                get
                {
                    DateTime time;
                    try
                    {
                        time = (DateTime)base[this.tableData.CreatedColumn];
                    }
                    catch (InvalidCastException exception)
                    {
                        throw new StrongTypingException("The value for column 'Created' in table 'Data' is DBNull.", exception);
                    }
                    return time;
                }
                set
                {
                    base[this.tableData.CreatedColumn] = value;
                }
            }

            [DebuggerNonUserCode]
            public string Database
            {
                get
                {
                    string str;
                    try
                    {
                        str = (string)base[this.tableData.DatabaseColumn];
                    }
                    catch (InvalidCastException exception)
                    {
                        throw new StrongTypingException("The value for column 'Database' in table 'Data' is DBNull.", exception);
                    }
                    return str;
                }
                set
                {
                    base[this.tableData.DatabaseColumn] = value;
                }
            }

            [DebuggerNonUserCode]
            public string Path
            {
                get
                {
                    string str;
                    try
                    {
                        str = (string)base[this.tableData.PathColumn];
                    }
                    catch (InvalidCastException exception)
                    {
                        throw new StrongTypingException("The value for column 'Path' in table 'Data' is DBNull.", exception);
                    }
                    return str;
                }
                set
                {
                    base[this.tableData.PathColumn] = value;
                }
            }

            [DebuggerNonUserCode]
            public int STT
            {
                get
                {
                    int num;
                    try
                    {
                        num = (int)base[this.tableData.STTColumn];
                    }
                    catch (InvalidCastException exception)
                    {
                        throw new StrongTypingException("The value for column 'STT' in table 'Data' is DBNull.", exception);
                    }
                    return num;
                }
                set
                {
                    base[this.tableData.STTColumn] = value;
                }
            }

            [DebuggerNonUserCode]
            public string Version
            {
                get
                {
                    string str;
                    try
                    {
                        str = (string)base[this.tableData.VersionColumn];
                    }
                    catch (InvalidCastException exception)
                    {
                        throw new StrongTypingException("The value for column 'Version' in table 'Data' is DBNull.", exception);
                    }
                    return str;
                }
                set
                {
                    base[this.tableData.VersionColumn] = value;
                }
            }
        }

        [GeneratedCode("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")]
        public class DataRowChangeEvent : EventArgs
        {
            private DataRowAction eventAction;
            private dsData.DataRow eventRow;

            [DebuggerNonUserCode]
            public DataRowChangeEvent(dsData.DataRow row, DataRowAction action)
            {
                this.eventRow = row;
                this.eventAction = action;
            }

            [DebuggerNonUserCode]
            public DataRowAction Action
            {
                get
                {
                    return this.eventAction;
                }
            }

            [DebuggerNonUserCode]
            public dsData.DataRow Row
            {
                get
                {
                    return this.eventRow;
                }
            }
        }

        public delegate void DataRowChangeEventHandler(object sender, dsData.DataRowChangeEvent e);
    }

}
